package com.jeesite.modules.kj.api.controller.contribute;

import com.jeesite.common.collect.ListUtils;
import com.jeesite.modules.kj.api.vo.response.ActivityPhaseResponseVo;
import com.jeesite.modules.kj.api.vo.response.ProjectPhaseResponseVo;
import com.jeesite.modules.kj.api.vo.responseVo.ResponseBean;
import com.jeesite.modules.kj.entity.KjActivityPhase;
import com.jeesite.modules.kj.entity.KjProjectPhase;
import com.jeesite.modules.kj.service.KjActivityPhaseService;
import com.jeesite.modules.kj.service.KjActivityService;
import com.jeesite.modules.kj.service.KjProjectPhaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Author:hzy
 * Date:2021/07/04
 * Description:
 */
@Api(value = "项目阶段api", tags = {"项目阶段api"})
@Slf4j
@Controller
@RequestMapping(value = "/api/projectPhase")
public class ProjectPhaseApiController {
    private final static Logger logger = LoggerFactory.getLogger(ProjectPhaseApiController.class);

    @Autowired
    KjProjectPhaseService kjProjectPhaseService;


    @ApiOperation(value = "获取活动的阶段列表", notes = "获取活动的阶段列表")
    @GetMapping(value = "list")
    public ResponseBean<List<ProjectPhaseResponseVo>> list(String projectId) {
        KjProjectPhase where = new KjProjectPhase();
        where.setProjectId(projectId);
        List<KjProjectPhase> dataList = kjProjectPhaseService.findList(where);
        List<ProjectPhaseResponseVo> vos = ListUtils.newArrayList();
        for (KjProjectPhase projectPhase: dataList
        ) {
            vos.add(new ProjectPhaseResponseVo(projectPhase));
        }
        return new ResponseBean<>(vos);
    }


}
